home *** CD-ROM | disk | FTP | other *** search
/ APC & TCP 4 / APC & TCP 4.iso / games / publicdomain / a / attacks / sources / input.def < prev    next >
Text File  |  1994-05-14  |  8KB  |  150 lines

  1. DEFINITION MODULE input;
  2.  
  3. (**************************************************************************)
  4. (*                                                                        *)
  5. (*   This module deals with all the input of the program, Ataxx.  It must *)
  6. (* be linked with the graphics module, because the IDCMP events are       *)
  7. (* linked to the window.  Therefore, some of the structures that should   *)
  8. (* be hidden in the ataxxgraphics module are visible so that this module  *)
  9. (* can use them.                                                          *)
  10. (*                                                                        *)
  11. (**************************************************************************)
  12.  
  13. FROM header
  14.   IMPORT   movetype, playertype, boardtype;
  15.  
  16. TYPE
  17.   eventtype = (MOVE,            (* Indicates that a move was attempted *)
  18.                ABOUT,           (* Request to display "About" info.    *)
  19.                OOPS,            (* A meaningless event (aborted menu)  *)
  20.                NEWGAME,         (* Signals that they want a new game.  *)
  21.                EDIT,            (* The user wants to edit the board    *)
  22.                BACKUP,          (* The user wants to back up a move    *)
  23.                REDO,            (* "               " redo a move.      *)
  24.                FORCE,           (* Force the computer to move now.     *)
  25.                QUIT);           (* Quit the program.                   *)
  26.  
  27. VAR
  28.   moveAttempted : movetype;     (* This global is where an attempted    *)
  29.                                 (*  move is stored while it is deter-   *)
  30.                                 (*  mined if the move is valid or not.  *)
  31.  
  32.  
  33. (**************************************************************************)
  34. PROCEDURE InitMenus;
  35.  
  36. (*   This initializes the menus for the program.  Simple.                 *)
  37. (*                                                                        *)
  38. (*   INPUT                                                                *)
  39. (*            n/a                                                         *)
  40. (*                                                                        *)
  41. (*   OUTPUT                                                               *)
  42. (*            The menus for the program now should work.                  *)
  43. (*                                                                        *)
  44.  
  45.  
  46. (**************************************************************************)
  47. PROCEDURE ChangeToEditMenu;
  48.  
  49. (*   Clears the current menu and makes the Edit menu.                     *)
  50. (*                                                                        *)
  51. (*   INPUT                                                                *)
  52. (*            n/a                                                         *)
  53. (*                                                                        *)
  54. (*   OUTPUT                                                               *)
  55. (*            Remakes the menu bar.                                       *)
  56.  
  57.  
  58. (**************************************************************************)
  59. PROCEDURE ChangeToComputerMenu;
  60.  
  61. (*   Clears the current menu and makes the menu to be displayed during    *)
  62. (* the time the computer is moving.                                       *)
  63. (*                                                                        *)
  64. (*   INPUT                                                                *)
  65. (*            n/a                                                         *)
  66. (*                                                                        *)
  67. (*   OUTPUT                                                               *)
  68. (*            Remakes the menu bar.                                       *)
  69.  
  70.  
  71. (**************************************************************************)
  72. PROCEDURE ChangeToMainMenu;
  73.  
  74. (*   Clears the current menu and makes the regular Main menu.             *)
  75. (*                                                                        *)
  76. (*   INPUT                                                                *)
  77. (*            n/a                                                         *)
  78. (*                                                                        *)
  79. (*   OUTPUT                                                               *)
  80. (*            Remakes the menu bar.                                       *)
  81. (*                                                                        *)
  82.  
  83.  
  84. (**************************************************************************)
  85. PROCEDURE CloseMenus;
  86.  
  87. (*   This closes and deallocates the memory for the menus.                *)
  88. (*                                                                        *)
  89. (*   INPUT                                                                *)
  90. (*            n/a                                                         *)
  91. (*                                                                        *)
  92. (*   OUTPUT                                                               *)
  93. (*            Kills the menus.                                            *)
  94. (*                                                                        *)
  95.  
  96.  
  97. (**************************************************************************)
  98. PROCEDURE EditBoard (VAR board : boardtype; VAR player : playertype)
  99.               : BOOLEAN;
  100.  
  101. (*   This procedure controls all the necessary input and outputs for mod- *)
  102. (* ifying the board and returns whether or not any changes were made.     *)
  103. (*                                                                        *)
  104. (*   INPUT                                                                *)
  105. (*            board             The current board.                        *)
  106. (*                                                                        *)
  107. (*            player            The current player to move.  This is      *)
  108. (*                              needed to return the pointer to the old   *)
  109. (*                              state.                                    *)
  110. (*                                                                        *)
  111. (*   OUTPUT                                                               *)
  112. (*            board             This is returned reflecting the modified  *)
  113. (*                              state.                                    *)
  114. (*                                                                        *)
  115. (*            The function returns TRUE only if the board was actually    *)
  116. (*            altered.  A return of FALSE signifies that no changes were  *)
  117. (*            made to the board.                                          *)
  118.  
  119.  
  120. (**************************************************************************)
  121. PROCEDURE WaitForMouseUp;
  122.  
  123. (*   This simple procedure just waits until the left mouse button is re-  *)
  124. (* leased.                                                                *)
  125.  
  126.  
  127. (**************************************************************************)
  128. PROCEDURE GetEvent(player : playertype) : eventtype;
  129.  
  130. (*   This procedure returns a code indicating a specific input event.     *)
  131. (* Such events are like a menu selection, or a player's move.  If the     *)
  132. (* event is a move, then the specific move will be specified in the var-  *)
  133. (* iable, moveAttempted.  It is expected that this routine will be called *)
  134. (* and then waited for until the user(s) makes some sort of imput.  It    *)
  135. (* is the responsibility of this and subordinate procedures to do the     *)
  136. (* waiting in a proper fashion.                                           *)
  137. (*                                                                        *)
  138. (*   INPUT                                                                *)
  139. (*            n/a                                                         *)
  140. (*                                                                        *)
  141. (*   OUTPUT                                                               *)
  142. (*            Returns a variable of eventtype that indicates the high-    *)
  143. (*            level input event.  If the event is a move by a player,     *)
  144. (*            then the var